﻿<UserControl
    x:Class="ShopPowerTemplate.Views.ShoppingCartButton"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:ShopPowerTemplate.Views"
    xmlns:converters="using:ShopPowerTemplate.Common"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="300"
    d:DesignWidth="400"
    x:Name="shoppingCartButton"
    >

    <UserControl.Resources>
        <converters:StringFormatConverter x:Key="StringFormatConverter" />
        <converters:StringToObjectConverter x:Key="BooleanToStringConverter">
            <x:String x:Key="True">&#x00a0;v</x:String>
            <x:String x:Key="False">&#x00a0;c</x:String>
        </converters:StringToObjectConverter>
    </UserControl.Resources>

    <Grid>
        <StackPanel Orientation="Horizontal">
            <TextBlock Text="Cesta&#x00a0;"
                       Style="{StaticResource SubheaderTextStyle}" 
                       Foreground="{Binding ElementName=shoppingCartButton, Path=Foreground}"></TextBlock>
            <TextBlock Text="{Binding ItemsCount, Converter={StaticResource StringFormatConverter}, ConverterParameter=(\{0\})}"
                       Style="{StaticResource SubheaderTextStyle}" 
                       Foreground="{Binding ElementName=shoppingCartButton, Path=Foreground}"></TextBlock>
            <TextBlock FontFamily="{StaticResource ApplicationFont}" 
                       Text="{Binding HasItems, Converter={StaticResource BooleanToStringConverter}}"
                       Style="{StaticResource SubheaderTextStyle}" 
                       Foreground="{Binding ElementName=shoppingCartButton, Path=Foreground}"></TextBlock>
        </StackPanel>
    </Grid>
</UserControl>
